<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-studentIc-edit" th:object="${student}">
            <input id="studentNumber" name="studentNumber" th:field="*{studentNumber}"  type="hidden">
            <input id="status" name="status" value="1"  type="hidden">
            <div class="form-group">	
                <label class="col-sm-3 control-label">姓名：</label>
                <div class="col-sm-8">
                    <input id="name" name="name" th:field="*{name}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">IC卡号：</label>
                <div class="col-sm-8">
                    <input id="icNumber" name="icNumber" class="form-control required" type="text">
                </div>
            </div>
			<div class="form-group">
				<div class="form-control-static col-sm-offset-9">
					<button type="submit" class="btn btn-primary">提交</button>
					<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "module/studentIc"
		$("#form-studentIc-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
				"icNumber":{
        			required:true,
        			maxlength: 10,
                    remote: {
                        url: ctx + "module/studentIc/checkIcNumber",
                        type: "post",
                        dataType: "json",
                        data: {
                        	icNumber: function () {
                                return $.trim($("#icNumber").val());
                            }
                        },
                        dataFilter: function (data, type) {
                        	if (data == "0") return true;
                            else return false;
                        }
                    }
        		}
			},
			messages: {
        		"icNumber":{
                	remote: "IC卡号已经存在"
        		}
            },
			submitHandler: function(form) {
				$.operate.save(prefix + "/save", $('#form-studentIc-edit').serialize());
			}
		});
	</script>
</body>
</html>
